<?php
require_once 'base.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Epigram Post</title>
</head>
<body>

<?php
require_once 'base.php';

// ------------- 添加 -------------
if (pm() == "POST"){
	$sqlInsert = 'INSERT INTO epigram (type, content, source, add_time) VALUES(' . fpost('type') . ', "' . fpost('content') . '", "' . fpost('source') . '", ' . time() . ')';
	$resource = @mysql_query($sqlInsert);
	if ($resource){
		Header('location: epigram.php');
		die;
	}else{
		die('Add error!');
	}
}

?>

<form action="epigrampost.php" method="post" />
<label>
	<select name="type">

<?php
// 分类
foreach($typeArr as $key => $v){
	echo '<option value="'. $key .'">' . $v . '</option>';
}
?>

	</select>
</label>
 
<br/>
 
<label><textarea name="content" cols="70" rows="7"></textarea></label>
 
<br/>
 
<label><input type="text" name="source" value="来源" size="50" /></label>
 
<br/><br/>
 
<input type="submit" value=" 提 交 " />
</form>

</body>
</html>